﻿<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>  
 <%@ taglib prefix="s"  uri="/struts-tags" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html lang="ja">
	<head>
		<title>login</title>
		<jsp:include page="../basePage/head.jsp" />
		<script src="../js/util/globalajaxevent.js"></script>
		<style>			
			#dialog-modal label, #dialog-modal input { display:block; } 
			#dialog-modal label { font-weight:bold ; margin-top: 0.5em ;}			
			#dialog-modal p  {font-size:12px;color:gray;margin: 0;padding: 0;font-weight: 200}
			.br{height:5px; display:block}
			hr{ height:1px;border:none;border-bottom:1px solid #C0D9D9;margin: 0;padding: 0 }
			.textbox { width: 98%; font-weight:400;height:20px;}
			.button{position:absolute; width:60px; height:25px;font-weight:bold }			
		</style>
		<script>
			$(function() {
				$('#loginform').bind('submit', function(event){
					var ret =false;
					$.ajax({
				        type: "POST",
				        async: false,
				        url:"login!loginCheck.action",
				        data:$('#loginform').serialize(),
						success: function (data) {
							ret = data.msg == "ERROR" ? false :true;
							if(ret==false){
								alert("ユーザー名、またパスワードが違います。！");
							}
						},
				        error: function (err) {
							alert(err);
				        }
				    });
					return ret;
				}); 
				
				var dialog= $( "#dialog-modal" ).dialog({					
					width: 450,
					height: 320,
					modal: true,
					buttons: {																															     
						  登録:function() {
						 	$("#loginform").submit();
						 },
						 キャンセル: function() {
							 $( this ).dialog( "close" );
							 window.close();
						 }
					}
				});	
				
				$('input:text:first').focus();
		        var $inp = $('input');
		        $inp.bind('keydown', function (e) {		            
		            if (e.which == 13) {
		            	if($(this).attr("name")!="user.userPass" && $(this).attr("name")!="savePass") {
		                	e.preventDefault();
		                	var nxtIdx = $inp.index(this) + 1;		                
		                	$("input:eq(" + nxtIdx + ")").focus();
		            	}
		            	else{
		            		$("#loginform").submit();
		            	}
		            }
		        });
			});
		</script>
	</head>
	<body>
		<div id="dialog-modal" title="ユーザ登録">
			<div id="result" class="result">
         		<span id="myIndicator" style="display: none" >
					<img  width=25 height=20 src="../img/ajax-loader.gif" alt="ロード中..." />ロード中.... 
				</span>
			</div>
			<form id="loginform" action="/PMData/login.action" method="post">
				<div class="br"></div>
				<label>ユーザ名:</label>
				<input type="text" name="user.userID" class="textbox"/>
				<p>ユーザー名を入力してください</p>								
				<div class="br"></div><div class="br"></div>				 
				<label>パスワード：</label>
				<input type="password" name="user.userPass"  class="textbox"/>
				<p>パスワードを入力してください</p>

				<div style="margin-top:7px;margin-bottom:0px">		 		 
   					<input style="display:inline-block;vertical-align:middle;" type="checkbox" name="savePass" id="checkbox1" checked=1 value="on" />   				
   					<label for="checkbox1" style="margin:0px;display:inline-block;font-weight:400;vertical-align:middle;">1週間ログインしたままにする</label>
				</div>
				
				<!--				<div class="br"></div><div class="br"></div>																
				<hr class="hr1">				
 				<input class="button" type="submit" value ="登陆" style="right:100px" />
				<input class="button" type="button" value ="退出" style="right:20px"/> -->
			</form>
		</div>
	</body>
</html>